//
//  HotCell.m
//  HYHOME
//
//  Created by cjy on 16/2/28.
//  Copyright © 2016年 Mac. All rights reserved.
//

#import "HotCell.h"
#import "HotModel.h"
#import "UIImageView+WebCache.h"
#import "DKNightVersion.h"

@implementation HotCell


- (void)dealloc{

    [self.pic release];
    [self.favs release];
    [self.title release];
    [self.thumb release];
    [self.sanjiao release];
    [self.description1 release];
    [super dealloc];




}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{


    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        

        
        [self createSubView];
    }


    return self;

}

- (void)createSubView{
    
    
    self.thumb = [[UIImageView alloc]init];
    
    [self.contentView addSubview:self.thumb];
    
    self.title = [[UILabel alloc]init];
    [self.contentView addSubview:self.title];
    
    self.description1 = [[UILabel alloc]init];
    [self.contentView addSubview:self.description1];
    
    
    
    
    self.sanjiao = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"iconfont-iconfontordinaryshangjiantou-2"]];
    
    [self.thumb addSubview:self.sanjiao];
    
    
    self.favs = [[UILabel alloc]init];
    [self.thumb addSubview:self.favs];
    
    self.pic = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"iconfont-xihuan"]];
    
    [self.favs addSubview:self.pic];
    
    [self.pic release];

    
    [self.favs release];
    [self.sanjiao release];
    [self.title release];
    [self.thumb release];
    [self.description1 release];


}

- (void)layoutSubviews{

    [super layoutSubviews];
    self.thumb.layer.shadowOffset = CGSizeMake(0, 1);
    self.thumb.layer.shadowOpacity = 1;
    
    self.thumb.layer.cornerRadius = 10;
    self.thumb.layer.masksToBounds = YES;

    
    self.thumb.frame = CGRectMake(5, 10, self.contentView. frame.size.width- 10, 200);
    self.title.frame = CGRectMake(10, 210, self.frame.size.width, 20);
    self.description1.frame = CGRectMake(10,230 , self.frame.size.width, 20);

    
    self.sanjiao.frame = CGRectMake(30, 187, 20, 20);
   
    self.favs.frame= CGRectMake(self.frame.size.width / 4 * 3 - 20, 20, self.thumb.frame.size.width / 5, 25);
    
    self.favs.textColor = [UIColor whiteColor];
    
    self.favs.backgroundColor = [UIColor blackColor];
    self.favs.alpha = 0.6;
    self.favs.layer.cornerRadius = 12;
    self.favs.layer.masksToBounds = YES;
    
    self.pic.frame = CGRectMake(7, 4, self.favs.frame.size.height - 12, self.favs.frame.size.height - 12);
    
    self.title.dk_textColorPicker = DKColorWithRGB(0x343434, 0xb8b8b8);
    self.description1.dk_textColorPicker = DKColorWithRGB(0x343434, 0xb8b8b8);
    self.favs.dk_textColorPicker = DKColorWithRGB(0xffffff, 0xb8b8b8);

    
    
    
  
}


- (void)passModel:(HotModel *)model{

    [self.thumb sd_setImageWithURL:[NSURL URLWithString:model.thumb] placeholderImage:[UIImage imageNamed:@"jz"]];
    self.title.font = [UIFont boldSystemFontOfSize:15];
    self.title.text = model.title;
    
    self.description1.text = model.description1;
    
    self.description1.font = [UIFont systemFontOfSize:13];
    self.description1.textColor = [UIColor blackColor];

    self.favs.text = [NSString stringWithFormat:@"      %@",[model.favs stringValue]];

}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
